package com.hc.accountservice.sqlprovider;

import com.hc.entity.PayRecord;
import org.apache.ibatis.jdbc.SQL;

/**
 * @BelongsProject: hc
 * @BelongsPackage: com.hc.accountservice.sqlprovider
 * @Author: WY
 * @CreateTime: 2022-10-19  16:48
 * @Descriprion: TODO
 * @Version: 1.0
 **/
public class SelectPayRecordSql {
    public String select(PayRecord payRecord){
        String sql = new SQL(){
            {
                SELECT("*");
                FROM("hc_payrecord");
                if(payRecord.getWay() !=null){
                    WHERE("way=#{way}");
                }
                if(payRecord.getDateTime() !=null){
                    WHERE("datetime=#{dateTime}");
                }
                WHERE("user_id=#{userId}");
                ORDER_BY("id desc");
            }
        }.toString();
        return sql;
    }
}
